// 公共设置key
let commonSettingKey = [{
        key: 'debugModel',
        type: "开关"
    },
    {
        key: 'debugSleep',
        type: "输入框"
    },
    {
        key: 'webSocketLog',
        type: "开关"
    },
    {
        key: '自动运行',
        type: "开关"
    },
    {
        key: 'canvasOffset',
        type: "输入框"
    },
    {
        key: '连续同一页面次数',
        type: "下拉框"
    },
    {
        key: '连续无匹配页面次数',
        type: "下拉框"
    },
    {
        key: "select业务",
        type: "下拉框"
    }
]

// 公共设置值域
let commonSettingRange = {
    "select业务": ["每日任务", "自动爬塔", "自动开宝箱"], // 业务名称值域列表
    "连续同一页面次数": [15, 20, 25, 30, 35, 40],
    "连续无匹配页面次数": [15, 20, 25, 30, 35, 40]
}


// 坐标偏移系数
let positionOffset = {
    "1080_1920": { // 标准分辨率不偏移
        "offsetX": 0,
        "offsetY": 0
    },
    "1080_2400": {
        "offsetX": 5,
        "offsetY": 0
    }
}

// 第一套匹配页面 命名规则 pageSetting_ + 业务名称
let pageSetting_每日任务 = {
    "游戏首页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [{
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "context": "战斗",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [424, 2098, "656", "2293"],
                "featuresThreshold": 0.7,
                "colorOther": [],
                "matchingType": "contains",
                "canvasMsg": "战斗"
            }],
            "multipleColor": [],
            "multipleImg": []
        }
    },
    "任务页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [{
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "任务",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "featuresThreshold": 0.7,
                "colorOther": [
                    [-364, 145, "#FFFFFF"],
                    [888, 507, "#56302F"],
                    [272, 743, "#DFA258"],
                    [146, 2067, "#404343"],
                    [214, 291, "#825420"]
                ],
                "matchingType": "contains",
                "canvasMsg": "任务",
                "position": [357, 406, "728", "518"],
                "color": "#009688"
            }],
            "multipleColor": [],
            "multipleImg": []
        }
    },
    "好友页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [{
                "threshold": "120",
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "好友",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [337, 402, 735, 516],
                "featuresThreshold": 0.7,
                "colorOther": [],
                "matchingType": "contains",
                "canvasMsg": "好友"
            }],
            "multipleColor": [],
            "multipleImg": []
        }
    },
    "咸将招募页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [],
            "multipleColor": [{
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "任务",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [106, 480, "417", "770"],
                "featuresThreshold": 0.7,
                "color": "#AB907A",
                "colorOther": [
                    [4, 29, "#100F0F"],
                    [13, -37, "#100E0C"],
                    [55, -3, "#BBA286"],
                    [48, -62, "#895C52"],
                    [79, -97, "#E6D4C4"],
                    [95, -98, "#0E0E0A"],
                    [101, -72, "#C6AD8D"],
                    [91, 12, "#ECDAC4"],
                    [86, 51, "#C5AA8B"],
                    [57, 63, "#A68674"],
                    [42, 84, "#A37138"],
                    [87, 87, "#AC783A"],
                    [119, 69, "#CBB293"],
                    [148, 6, "#F3DFCB"],
                    [172, -2, "#F3DFC7"],
                    [179, -14, "#EFDEC6"],
                    [162, -25, "#AD783A"],
                    [173, 26, "#674222"],
                    [176, 60, "#211D22"]
                ],
                "canvasMsg": "咸"
            }],
            "multipleImg": []
        }
    },
    "弹层页面": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [{
                "position": ["0", "0", "1080", "2400"],
                "threshold": "60",
                "maxVal": "255",
                "context": "点击空白区域",
                "matchingType": "contains",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "canvasMsg": "点击空白区域关闭"
            }],
            "multipleColor": [],
            "multipleImg": []
        }
    },
    "分享页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [{
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "选择一个聊天",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [361, 123, "713", "225"],
                "featuresThreshold": 0.7,
                "colorOther": [],
                "matchingType": "contains"
            }],
            "multipleColor": [],
            "multipleImg": []
        }
    },
    "每日点金页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [],
            "multipleColor": [],
            "multipleImg": []
        }
    },
    "黑市物品页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [],
            "multipleColor": [],
            "multipleImg": []
        }
    },
    "客厅页": {
        "1080_2400": {
            "relation": {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or"
            },
            "analysisChart": [],
            "multipleColor": [],
            "multipleImg": []
        }
    }
}

// 第二套匹配页面
let pageSetting_自动爬塔 = {
    "竞技场": {
        "1080_2400": {
            'relation': {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or",
                "nextKey": "选择队伍_待开始"
            },
            'analysisChart': [{
                "position": [1101, 376, 1283, 422],
                "threshold": 60,
                "maxVal": 255,
                "context": "锁定",
                "matchingType": "contains",
                "isOpenGray": 1,
                "isOpenThreshold": 1,
                "canvasMsg": "锁定"
            }],
            'multipleColor': [],
            'multipleImg': [{
                "position": [1101, 376, 1283, 422],
                "threshold": 60,
                "maxVal": 255,
                "pathName": "./res/锁定队伍_锁定队伍.png",
                "imgThreshold": 0.8,
                "isOpenGray": 1,
                "isOpenThreshold": 1,
                "canvasMsg": "锁定队伍_锁定队伍"
            }]
        }
    }
}

// 第三套匹配页面
let pageSetting_自动开宝箱 = {
    "竞技场": {
        "1080_2400": {
            'relation': {
                "total": "or",
                "analysisChart": "or",
                "multipleColor": "or",
                "multipleImg": "or",
                "nextKey": "选择队伍_待开始"
            },
            'analysisChart': [{
                "position": [1101, 376, 1283, 422],
                "threshold": 60,
                "maxVal": 255,
                "context": "锁定",
                "matchingType": "contains",
                "isOpenGray": 1,
                "isOpenThreshold": 1,
                "canvasMsg": "锁定"
            }],
            'multipleColor': [],
            'multipleImg': [{
                "position": [1101, 376, 1283, 422],
                "threshold": 60,
                "maxVal": 255,
                "pathName": "./res/锁定队伍_锁定队伍.png",
                "imgThreshold": 0.8,
                "isOpenGray": 1,
                "isOpenThreshold": 1,
                "canvasMsg": "锁定队伍_锁定队伍"
            }]
        }
    }
}


// 业务操作参数
let serviceOperateParam = {
    "游戏首页": {
        "首页找图点击未展开任务列表": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "context": "",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [3, 315, "212", "616"],
                "featuresThreshold": 0.7,
                "colorOther": [],
                "pathName": "/sdcard/appSync/hz_autojs_xyzw/res/1080_2400/首页_任务列表图标.png"
            }
        },
        "首页识字点击任务文字": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "context": "任务",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [9, 832, "340", "1079"],
                "featuresThreshold": 0.7,
                "colorOther": [],
                "pathName": ""
            }
        }
    },
    "任务页": {
        "文字识别获取领取坐标": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "领取",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "featuresThreshold": 0.7,
                "colorOther": [],
                "matchingType": "contains",
                "canvasMsg": "",
                "position": [703, 996, "989", "1877"]
            }
        },
        "任务列表文字区域": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [270, 997, 764, 1859],
                "featuresThreshold": 0.7,
                "colorOther": []
            }
        },
        "任务列表按钮区域": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [717, 1003, "993", "1844"],
                "featuresThreshold": 0.7,
                "colorOther": []
            }
        },
        "任务标题栏区域": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "任务",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "featuresThreshold": 0.7,
                "colorOther": [
                    [-364, 145, "#FFFFFF"],
                    [888, 507, "#56302F"],
                    [272, 743, "#DFA258"],
                    [146, 2067, "#404343"],
                    [214, 291, "#825420"]
                ],
                "matchingType": "contains",
                "position": [357, 406, "728", "518"],
                "color": "#009688"
            }
        },
        "周活跃奖励区域": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [308, 549, "983", "737"],
                "featuresThreshold": 0.7,
                "color": "#FEFDC7",
                "colorOther": [
                    [4, -2, "#ECC138"]
                ]
            }
        },
        "日活跃奖励区域": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "选择一个聊天",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [301, 771, "985", "964"],
                "featuresThreshold": 0.7,
                "color": "#FAF48A",
                "colorOther": [
                    [2, 0, "#FAF58B"],
                    [5, 0, "#FAF48A"]
                ]
            }
        },
        "识字点击返回主界面": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "返回主界面",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [177, 1553, "926", "2013"],
                "featuresThreshold": 0.7,
                "colorOther": []
            }
        }
    },
    "好友页": {
        "识字点击一键领取": {
            "1080_2400": {
                "threshold": "120",
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "一键领取",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [325, 1795, "766", "1929"],
                "featuresThreshold": 0.7,
                "colorOther": []
            }
        },
        "点击返回主界面": {
            "1080_2400": {
                "threshold": "120",
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "点击任意|主界面",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [312, 1701, "764", "1779"],
                "featuresThreshold": 0.7,
                "colorOther": []
            }
        },
        "识字一键领取不可点击": {
            "1080_2400": {
                "threshold": "100",
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "一键领取",
                "isOpenGray": 1,
                "isOpenThreshold": 1,
                "featuresThreshold": 0.7,
                "colorOther": [],
                "position": [325, 1795, "766", "1929"]
            }
        },
        "找图点击关闭": {
            "1080_2400": {
                "threshold": "100",
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "/sdcard/appSync/hz_autojs_xyzw/res/1080_2400/好友页_关闭.png",
                "context": "",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "featuresThreshold": 0.7,
                "colorOther": [],
                "position": [393, 1962, "713", "2203"]
            }
        }
    },
    "咸将招募页": {
        "免费招募区域": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "任务",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [129, 1838, "483", "1926"],
                "featuresThreshold": 0.7,
                "colorOther": []
            }
        },
        "招募一次区域": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "任务",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [112, 1525, "494", "1840"],
                "featuresThreshold": 0.7,
                "color": "#0B0A0B",
                "colorOther": []
            }
        },
        "点击任意区域返回": {
            "1080_2400": {
                "threshold": 60,
                "maxVal": 255,
                "imgThreshold": 0.7,
                "colorThreshold": 26,
                "bigScale": 1,
                "smallScale": 1,
                "pathName": "",
                "context": "返回",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "position": [380, 2114, "694", "2192"],
                "featuresThreshold": 0.7,
                "colorOther": []
            }
        }
    },
    "弹层页面": {
        "点击空白区域关闭": {
            "1080_2400": {
                "position": ["0", "0", "1080", "2400"],
                "threshold": "60",
                "maxVal": "255",
                "context": "点击空白区域",
                "matchingType": "contains",
                "isOpenGray": 0,
                "isOpenThreshold": 0,
                "canvasMsg": "点击空白区域关闭",
                "pathName": ""
            }
        }
    },
    "分享页": {},
    "每日点金页": {},
    "黑市物品页": {},
    "客厅页": {}
}

// 默认逻辑关系
const relationDeafult = {
    "total": "or",
    "analysisChart": "or",
    "multipleColor": "or",
    "multipleImg": "or"
}


let constant = {
    'commonSettingKey': commonSettingKey,
    'commonSettingRange': commonSettingRange,
    'positionOffset': positionOffset,
    'serviceOperateParam': serviceOperateParam,
    'relationDeafult': relationDeafult
}

let select业务 = commonSettingRange.select业务
select业务.forEach((item) => {
    let key = 'pageSetting_' + item;
    constant[key] = this[key]
})

module.exports = constant